<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page import="avicit.platform6.commons.utils.ViewUtil"%>
<%@ page import="avicit.platform6.commons.utils.ComUtil"%>
<%@ taglib prefix="sec" uri="/WEB-INF/tags/shiro.tld" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@page import="avicit.platform6.core.locale.PlatformLocalesJSTL"%>
<%@page import="java.util.Locale"%>
<%@page import="avicit.platform6.api.session.SessionHelper"%>
<%@page import="avicit.platform6.api.sysshirolog.impl.AfterLoginSessionProcess"%>
<% 
Object lang=session.getAttribute(AfterLoginSessionProcess.SESSION_CURRENT_LANGUAGE_CODE);
String languageCode="zh_CN";
if(lang!=null){
	languageCode=lang.toString();
}
	Locale locale =SessionHelper.getLocaleByUser(request);
	String orgId = SessionHelper.getCurrentOrgId(request);
%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<base href="<%=ViewUtil.getRequestPath(request)%>">
<jsp:include page="/avicit/platform6/component/common/EasyUIJsInclude.jsp"></jsp:include>
<jsp:include page="/avicit/im/common/ImUIJSCSSInclude.jsp"></jsp:include>
<script src="static/js/platform/component/common/exportData.js" type="text/javascript"></script>
<script type="text/javascript" src="avicit/im/lantop/basic/reportmanager/js/PrintReport.js"></script>
<script type="text/javascript"
	src="avicit/im/lantop/basic/reportmanager/locale/language_<%=languageCode%>.js"></script>
<link href="static/css/custom/lantop/css/custom.css" type="text/css"  rel="stylesheet">
<title>打印报表</title>


<script type="text/javascript">
	var baseHref = "<%=ViewUtil.getRequestPath(request)%>";
	var dialogId = '${dialogId}';
	var tableNameIds = '${tableNameIds}';
	var tableNames = '${tableNames}';
	var sysId = '${sysId}';
	var ids = parent.reportSelectIds;
	var conditions = "${conditions}";
	var isPublic = "${isPublic}";
	var tableColsStr = '${tableColsStr}';
	var viewName = "${viewName}";
	var archiveTableIds = "${archiveTableIds}";
	var reportViewType = "${reportViewType}";
	var tableId = "${tableId}";
	var nodeId = "${nodeId}";
	var openType = "${openType}";
	var sysFlag = "${sysFlag}";
	var orgId = "<%=orgId%>";
	var type = "root";
	var printReport;
	var fileIds = "${fileIds}";
	
	$(function(){
		
		printReport = new PrintReport();
		if (null != openType && "select" == openType) {
			$('#onlySelect').attr('disabled', true);
		}
		if(orgId != "ORG_ROOT"){
			// 初始化树
			$("#reportTree").tree({
				checkbox : false, 			// 是否带复选框
				lines : true,			// 线条 
				onClick : function(node){
	 				type = "nRoot";
				}
			});
			// 加载符合条件的模板集合
			reLoadTree();
		}
		
		
		// 初始化树
		$("#reportTreeRoot").tree({
			checkbox : false, 			// 是否带复选框
			lines : true,			// 线条 
			onClick : function(node){
 			/* if(orgId == "ORG_ROOT"){
				$("#deleteReportId").show();
				}else{
					$("#deleteReportId").hide();
				} */
				type = "root";
			}
		});
		// 加载符合条件的模板集合
		reLoadTreeRoot();
		
	});
	
	
	function reLoadTree(){
		var args = {
				sysId : sysId,
				tableNames : tableNames,
				type : "nroot"
			};
			$.ajax({
				url : "platform/im/lantop/basic/ReportManagerController/findtreebytablename",
				type : 'post',
				dataType : 'json',
				data :{
					param : JSON.stringify(args)
				},
				success : function(data){
					var d= data.data;
					if(d.length>0){
						var parentId  = d[0]._parentId;
						if(parentId != null){
							$("#reportTree").tree('loadData', data.data);
						}else{
							$("#reportTree").tree('loadData', []);
						}
					}else{
						$("#reportTree").tree('loadData', []);
					}
					
				}
			});
	}
	
	function reLoadTreeRoot(){
		var args = {
				sysId : sysId,
				tableNames : tableNames,
				type : "root"
			};
			$.ajax({
				url : "platform/im/lantop/basic/ReportManagerController/findtreebytablename",
				type : 'post',
				dataType : 'json',
				data :{
					param : JSON.stringify(args)
				},
				success : function(data){
					var d= data.data;
					if(d.length>0){
						var parentId  = d[0]._parentId;
						if(parentId != null){
							$("#reportTreeRoot").tree('loadData', data.data);
						}else{
							$("#reportTreeRoot").tree('loadData', []);
						}
					}else{
						$("#reportTreeRoot").tree('loadData', []);
					}
				}
				
			});
	}

	window.onresize = function(){
		setTimeout(function(){
			$("#printfSelectDialog").dialog('resize',{
				width: $(window).width(),
				height: $(window).height()
			});
		},300)
	}
</script>

	<style>
	 .tree-file{
	    margin-top:5px !important; 
	 }
	</style>
	
<body class="easyui-layout" data-options="fit:true">
	<div data-options="region:'north',title:'',split:false, noheader:true, border:false" style="height:30px;line-height: 30px;overflow: hidden;">
		 <div style="margin-left: 20px;">
			 <%--数据设置： --%>
			 <label><%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.reportmanager.printreport.dataset","i18n.lantop",locale)%></label>
			 <sec:accesscontrollist hasPermission="3" domainObject="reportManager_printReport_all">
			 	<%--全部 --%>
			 	<input type="radio" name="dataType" value="all" style="vertical-align: sub;"/> <%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.reportmanager.printreport.all","i18n.lantop",locale)%>
			 </sec:accesscontrollist>
			 
			 <sec:accesscontrollist hasPermission="3" domainObject="reportManager_printReport_other">
			 	<%--仅选中--%>
			 	<input id="onlySelect" type="radio" name="dataType" checked value="select" style="vertical-align: sub;"/> <%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.reportmanager.printreport.onlyselect","i18n.lantop",locale)%>
			 </sec:accesscontrollist>
		 </div>
	
	</div>   
     
    <div data-options="region:'center',title:'',split:false, noheader:true,border:false" style="padding:0px;">
    
    	<div id="cc" class="easyui-layout" fit="true" data-options="border:false">
		    <div data-options="region:'north',title:'',split:false, noheader:true,  border:true" style="height:40px; overflow: hidden;">
		    	<div style="margin-left:14px;" >
				    <sec:accesscontrollist hasPermission="3" domainObject="reportManager_printReport_selectReport">
						<%--选择报表--%>
						<a class="easyui-linkbutton selbtnc" iconCls="icon-im-newother" title="<%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.reportmanager.printreport.selectreport","i18n.lantop",locale)%>"
							onclick="printReport.selectReport()" href="javascript:void(0);"><%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.reportmanager.printreport.selectreport","i18n.lantop",locale)%></a>
					</sec:accesscontrollist>
					 <sec:accesscontrollist hasPermission="3" domainObject="reportManager_printReport_selectReport">
						<%--删除报表--%>
						<a class="easyui-linkbutton selbtnc" id="deleteReportId" iconCls="icon-im-remove" title="<%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.reportmanager.printreport.deletereport","i18n.lantop",locale)%>"
							onclick="printReport.deleteReport()" href="javascript:void(0);"><%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.reportmanager.printreport.deletereport","i18n.lantop",locale)%></a> 
					</sec:accesscontrollist>
					<sec:accesscontrollist hasPermission="3" domainObject="reportManager_printReport_configReport">
						<%--配置报表--%>
					<a class="easyui-linkbutton selbtnc" iconCls="icon-im-edit" title="<%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.reportmanager.printreport.reportconfig","i18n.lantop",locale)%>"
						onclick="printReport.configReport()" href="javascript:void(0);"><%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.reportmanager.printreport.reportconfig","i18n.lantop",locale)%></a> 
					</sec:accesscontrollist>
					<sec:accesscontrollist hasPermission="3" domainObject="reportManager_printReport_printf">
						<%--打印--%>
					<a class="easyui-linkbutton selbtnc" iconCls="icon-im-print"title="<%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.reportmanager.printreport.print","i18n.lantop",locale)%>"
						onclick="printReport.printf();" href="javascript:void(0);"><%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.reportmanager.printreport.print","i18n.lantop",locale)%></a> 
					</sec:accesscontrollist>
					<sec:accesscontrollist hasPermission="3" domainObject="reportManager_printReport_cancel">
						<%--取消--%>
					<a class="easyui-linkbutton selbtnc" iconCls="icon-im-back" title="返回"
						onclick="printReport.cancel();" href="javascript:void(0);">返回</a> 
					</sec:accesscontrollist>
				</div>
			</div>   
		    <div data-options="region:'center',title:'',split:false, noheader:true, border:true" style="padding:0px;">
		    	<div id="cc" class="easyui-layout" fit="true" style="width:100%;height:100%;">
					<%if(!orgId.equals("ORG_ROOT")){%>
					    <div class="div_scroll" data-options="region:'south'" style="height:280px;border-top:1px solid #dedede;">
					    	<ul id="reportTree"></ul>
					    </div>   
					<%} %>
				    <div class="div_scroll" data-options="region:'center'" style="border-top:1px solid #dedede;">
				     	<ul id="reportTreeRoot"></ul>
				    </div>   
				</div>  
		    </div>   
		</div>
    </div>
    
   
    <!-- 滚动条样式设置  liuguiling 2019-07-6-->
<script type="text/javascript" src="static/js/platform/index/js/divscroll.js" ></script>
<script>
 $(function(){
  $(".easyui-layout").perfectScrollbar();
  $(".div_scroll").perfectScrollbar();
 });
</script>
<!-- end-->	
</body>
	
</html>